﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Level_Editor
{
    class Instance
    {
        public static int waypoints = 0;
        public static int waypointIndices = 0;

        public int actualIndex;
        public int index;
        public int x;
        public int y;

        public Actor actor;
        public int angle;
        public int spawn;

        public int tolerance;

        public List<Instance> neighbours;

        override public String ToString()
        {
            if (actor != null)
                return actor.ToString() + " " + index.ToString();
            else
                return "Waypoint " + index.ToString();
        }

        public Instance(Actor actor)
        {
            x = 0;
            y = 0;
            angle = 0;
            spawn = 0;
            this.actor = actor;
            neighbours = new List<Instance>();

            if (actor != null)
            {
                actor.instances++;
                actor.instanceIndices++;
                index = actor.instanceIndices;
                tolerance = (actor.actors[0].Width + actor.actors[0].Height) * 2;
            }
            else
            {
                waypoints++;
                waypointIndices++;
                index = waypointIndices;
                tolerance = 35;
            }
        }

        public bool isWaypoint()
        {
            return actor == null;
        }

    }
}
